#!/bin/bash -e

function info() {
echo Usage: `basename $0` '[-l in.bed] in.vcf'
exit 1
}

while getopts ":p:l:mgh" opts
do
case $opts in
	m) somatic=T;;
	g) single_cell=T;;
	l) interval=$OPTARG;;
	p) out_prefix=$OPTARG;;
	\?) info;;
esac
done
shift $(($OPTIND - 1))

test $# -lt 1 && info

. $var

in=$1


# java $j_mem -jar $snpsift rmInfo $in AF > $out_prefix.anno0_0_0.vcf

# java $j_mem -jar $snpsift \
# annotate \
# -info AF $data_path/gatk/vcf/1000G_phase1.snps.high_confidence.b37.vcf  \
# $out_prefix.anno0_0_0.vcf \
# > $out_prefix.anno0_0.vcf

# cat $out_prefix.anno0_0.vcf | $java_run/snpsift filter "(! (AF > 0.01))" > $out_prefix.anno0_1.vcf



# echo;echo;echo snpsift annotate dbsnp
# java $j_mem -jar $snpsift \
# annotate -info COMMON \
# $data_path/ncbi/dbsnp/All_20150605.vcf.gz \
# $out_prefix.anno0_1.vcf \
# > $out_prefix.anno0_2.vcf

# cat $out_prefix.anno0_2.vcf | $java_run/snpsift filter "(! (COMMON = 1))" > $out_prefix.anno0_3.vcf



# cat $out_prefix.anno0_4.vcf | $java_run/snpsift filter "(! (ANN[0].IMPACT = 'LOW'))" > $out_prefix.anno0_5.vcf


echo;echo;echo snpsift annotate dbsnp
java $j_mem -jar $snpsift \
annotate \
$data_path/ncbi/clinvar/clinvar_20150901.vcf.gz \
$1 \
> $out_prefix.clinvar.vcf



echo;echo;echo snpsift annotate gwasCat
java $j_mem -jar $snpsift \
gwasCat \
-db ${data_path}/snpeff/gwascatalog.txt \
$1 \
> $out_prefix.gwas.vcf

    
. $cmd_done